package stark.app.function.news;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

import stark.app.R;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;

/**
 * Author：daizhongbin on 2022/12/1
 * Email：1027154338@qq.com
 * Desc:
 */
public class NewsImgAdapter extends StkProviderMultiAdapter<String> {

    public NewsImgAdapter() {
        super(3);
        addItemProvider(new ItemProvider());
    }

    private class ItemProvider extends BaseItemProvider<String> {

        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_news_img;
        }

        @Override
        public void convert(@NotNull BaseViewHolder holder, String imgUrl) {
            ImageView ivImg = holder.getView(R.id.ivImg);
            Glide.with(ivImg).load(imgUrl).into(ivImg);
        }
    }

}
